package com.pur.zsms.dao.impl;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Query;

import net.sf.json.JSONObject;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Repository;

import com.pur.zsms.common.dao.GenericDao;
import com.pur.zsms.common.dao.JpaTemplate;
import com.pur.zsms.common.exception.GenericException;
import com.pur.zsms.common.support.PageController;
import com.pur.zsms.common.support.PaginationSupport;
import com.pur.zsms.dao.IDistributorDao;
import com.pur.zsms.dao.SupplierShopDao;
import com.pur.zsms.documentsmanage.dao.IDomDao;
import com.pur.zsms.documentsmanage.po.DomPo;
import com.pur.zsms.foodmanage.food.dao.IFoodDao;
import com.pur.zsms.foodmanage.food.po.FoodMaterPo;
import com.pur.zsms.foodmanage.food.po.FoodPo;
import com.pur.zsms.foodmanage.food.vo.FoodMaterVo;
import com.pur.zsms.foodmanage.food.vo.FoodVo;
import com.pur.zsms.matermanage.mater.vo.MaterVo;
import com.pur.zsms.matermanage.mater.vo.OrderDistributorMaterRealVo;
import com.pur.zsms.ordercustommanage.po.OrderDistributorMaterRealPo;
import com.pur.zsms.ordercustommanage.po.OrderDistributorPo;
import com.pur.zsms.ordercustommanage.po.OrderSupplierPo;
import com.pur.zsms.ordercustommanage.vo.OrderDistributorVo;
import com.pur.zsms.ordercustommanage.vo.OrderSupplierVo;
import com.pur.zsms.pmsnmanage.menu.po.MenuPo;
import com.pur.zsms.pmsnmanage.role.vo.RoleVo;
import com.pur.zsms.pmsnmanage.user.dao.IUserDao;
import com.pur.zsms.pmsnmanage.user.po.UserPo;
import com.pur.zsms.pmsnmanage.user.po.UserRolePo;
import com.pur.zsms.pmsnmanage.user.vo.UserVo;
import com.pur.zsms.po.SupplierShopPo;
import com.pur.zsms.supplier.po.SupplierPo;
import com.pur.zsms.systemsetting.datadictionary.po.CodeType;
import com.pur.zsms.vo.SupplierShopVo;

@Repository("supplierShopDao")
public class SupplierShopDaoImpl extends GenericDao implements SupplierShopDao {

	public void addSupplierShopDao(SupplierShopPo c) throws GenericException {
		persist(c);
	}

	public void updateSupplierShopDao(SupplierShopPo c) throws GenericException {
		merge(c);
	}

	public List<SupplierShopPo> getSupplierShopPo(SupplierShopVo c) throws GenericException {
		JpaTemplate template = this.getTemplate();
		StringBuffer sql = new StringBuffer();
		sql.append(" select o from SupplierShopPo o where 1=1 ");
		if (c.getShopId() != 0) {
			sql.append(" AND o.shopId = '" + c.getShopId() + "'");
		}
		if (c.getSupId() != 0) {
			sql.append(" AND o.supId = '" + c.getSupId() + "'");
		}
		List<SupplierShopPo> list = template.find(sql.toString(), null);
		return list;
	}

}
